package com.tanklab.mathless;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class FileManager {

    public static String exec(String cmd){
        StringBuffer sb = new StringBuffer();
        try{
            Runtime runtime = Runtime.getRuntime();
            Process process = runtime.exec(cmd);
            BufferedReader br = new BufferedReader(new InputStreamReader(process.getInputStream()));
            String line;
            while((line = br.readLine())!=null){
                sb.append(line).append("\n");
            }
            br.close();
        }catch(IOException ex){
            ex.printStackTrace();
        }finally {
            return sb.toString();
        }
    }


}
